 <link rel="stylesheet" href="../Public/style/forum.css" />、
 <script>
function sub_save(){
	
	$("#myform").submit();
	}
</script>
 	 <div id="top">
		 <div class="head1 clear">
			 <div class="account sprite_icon" style="text-align:center; ">
                  <a href="index.php?g=Mobile&m=User&a=index" style=" color:#FFF; line-height:50px">
                 {if cookie('username')}
                  {php $user=M('User')->field('username')->where('id='.$jgsatuserid)->find()}
                  {php echo $user['username']} 
                 {else}登录
                 {/if}
                 </a>
			 </div>
			   {if $title}
			    <div class="title">{$title}</div> 
               {else}
                <div class="title">{$seo_title}</div> 
               {/if}<div class="search sprite_icon">
			     <span class="keep" onclick="sub_save()">确定</span>
			 </div>
		 </div>
	 </div>	 
<include file="Mobile:nav"/> 
     
     
     
     <div class="forum_clasfi">
		 <div class="text clear">
			 <strong>主题：</strong>
			 <div class="F_choose">
				 <span>{$plate['name']}</span>
				 <!--<i></i>

				 <ul class="menu">
					 <li>装修问答</li>
					 <li>装修把关</li>
					 <li>餐饮店装修经验</li>
					 <li>餐饮设备购买需求</li>
					 <li>餐饮店攻略</li>
					 <li>设计师交流</li>
					 <li>广告专区</li>
					 <li>招聘专区</li>
					 <li>案例下载</li>
				 </ul>-->
			 </div>
			 
		 </div>
<form id="myform" action="index.php?g=Mobile&m=Zforum_theme&a=insert" method="post"  >
<input  type="hidden" name="plateid" value="{$plate['id']}" />
		 <div class="text clear">
			 <strong>标题：</strong>
			 <div class="F_choose">
				 <input name="title" type="text"  id="title" />
			 </div>
		 </div>

		 <div class="F_content clear">
			 <strong>内容：</strong>
			 <textarea style="font-family:微软雅黑"  name="content" id="" placeholder=""></textarea>
              
		 </div>
</form>	 
	 </div>	 

	 <div class="upload clear">
		 <!--<span></span>-->
		 <a class="btn" id="btn"></a>
          <ul id="ul_pic" class="ul_pics clearfix"></ul>
	 </div>
  <style>
    #thumb img{ margin-left:2% }
  </style>
     <div style="padding: 12px 0 0 56px;" id="thumb">
		<ul id="ul_pic" class="ul_pics clearfix"></ul>
        
	 </div>
    
     <script>
$("#title").keyup(function(){
var title=$("#title").val();

var len = 0; 
for (var i = 0; i < title.length; i++) { 
if (title[i].match(/[^\x00-\xff]/ig) != null) //全角 
len += 2; 
else 
len += 1; 
} 
if(len>48){
	var t=getByteVal(title,60)
	var ll=Math.ceil((60-len)/2);
	$("#title").val(t);
	$("#tishi").html('还可输入'+ll+'个字');
	}else{
		$("#tishi").html(' ');
		}

//do something

//删除超出的 字符
function getByteVal(val, max) { 
var returnValue = ''; 
var byteValLen = 0; 
for (var i = 0; i < val.length; i++) { 
if (val[i].match(/[^\x00-\xff]/ig) != null) 
byteValLen += 2; 
else 
byteValLen += 1; 
if (byteValLen > max) 
break; 
returnValue += val[i]; 
} 
return returnValue; 
} 

});
</script>
 <script type="text/javascript" src="../Public/upload/plupload/plupload.full.min.js"></script>
<script>
$( function(){
            var uploader = new plupload.Uploader({ //创建实例的构造方法
                runtimes: 'html5,flash,silverlight,html4', //上传插件初始化选用那种方式的优先级顺序
                browse_button: 'btn', // 上传按钮
                url: "index.php?g=Mobile&m=Upload&a=index", //远程上传地址
                flash_swf_url: '../Public/upload/plupload/Moxie.swf', //flash文件地址
                silverlight_xap_url: '../Public/upload/plupload/Moxie.xap', //silverlight文件地址
                filters: {
                    max_file_size: '10mb', //最大上传文件大小（格式100b, 10kb, 10mb, 1gb）
                    mime_types: [//允许文件上传类型
                        {title: "files", extensions: "jpg,png,gif"}
                    ]
                },
                multi_selection: false, //true:ctrl多文件上传, false 单文件上传
                init: {
                    FilesAdded: function(up, files) { //文件上传前
                        if ($("#ul_pic").children("li").length > 30) {
                            alert("您上传的图片太多了！");
                            uploader.destroy();
                        } else {
                            var li = '';
                            plupload.each(files, function(file) { //遍历文件
                                li += "<li id='" + file['id'] + "'><div class='progress'><em class='bar'></span><span class='percent'>0%</span></div></li>";
                            });
                           // $("#ul_pic").append(li);
                            uploader.start();
                        }
                    },
                    UploadProgress: function(up, file) { //上传中，显示进度条
                 var percent = file.percent;
                        //$("#" + file.id).find('.bar').css({"width": percent + "%"});
                        //$("#" + file.id).find(".percent").text(percent + "%");
                    },
                    FileUploaded: function(up, file, info) { //文件上传成功的时候触发
					
                       var data = eval("(" + info.response + ")");
					  // alert(data.name)
                        //$("#" + file.id).html("<div class='img'><img src='" + data.pic + "'/></div><p>" + data.name + "</p>");
						//document.getElementById("thumb_pic").src=data.pic;
						$("#thumb").append('<img width="20%" src="'+ data.pic +'"/>');
						$(".F_choose").append('<input  name="pics[]"class="input-text" type="hidden" value="'+ data.pic +'" name="pics[]" size="50">');
                    },
                    Error: function(up, err) { //上传出错的时候触发
					if(err.message=='File size error.'){
						err.message='图片大小超过限制';
						};
                        alert(err.message);
                    }
                }
            });
			 uploader.init();
			})

</script>

